package com.lei.androidheight_four.model;

import com.lei.androidheight_four.contract.LoginContract;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;

import java.util.HashMap;

public class LoginModel implements LoginContract.Model {
    @Override
    public void login(String name, String pwd, StringCallback callback) {
        HashMap<String,String> map = new HashMap<>();
        map.put("username",name);
        map.put("password",pwd);

        OkGo.<String>post("https://www.wanandroid.com/user/login").params(map).execute(callback);
    }

    @Override
    public void register(String name, String pwd,StringCallback callback) {
        HashMap<String,String> map = new HashMap<>();
        map.put("username",name);
        map.put("password",pwd);
        map.put("repassword",pwd);

        OkGo.<String>post("https://www.wanandroid.com/user/register").params(map).execute(callback);
    }

    @Override
    public void destroy() {

    }
}
